﻿/**
 * Fill
 *
 * @author		Allen Chou
 * @version		1.0.0 (last update: Jun 3 2008)
 * @link        http://cjcat.blogspot.com
 * @link		http://cjcat2266.deviantart.com
 */

package idv.cjcat.display {
	
	/**
	 * The <code>Fill</code> class lets you store all the information required
	 * when using <code>flash.display.Graphics.beginFill()</code> in a single object,
	 * which can be conveniently reused.
	 * 
	 * <p>
	 * Use <code>Fill</code> through <code>CJDisplay.lineStyle()</code> to set the
	 * line style of the <code>Graphics</code> object of a <code>Shape</code> or <code>Sprite</code>.
	 * </p>
	 * 
	 * @example
	 * <listing>
	 * //original begin() usage
	 * clip1_mc.graphics.beginFill(color, alpha);
	 * clip2_mc.graphics.beginFill(color, alpha);
	 * clip3_mc.graphics.beginFill(color, alpha);
	 * 
	 * //equivalent using LineStyle and CJGraphics
	 * var fill:Fill = new Fill(fill.color, fill.alpha);
	 * CJDisplay.beginFill(clip1_mc, fill);
	 * CJDisplay.beginFill(clip2_mc, fill);
	 * CJDisplay.beginFill(clip3_mc, fill);</listing>
	 */
	public class Fill {
		
		/**
		 * Fill color.
		 */
		public var color:uint;
		/**
		 * Fill alpha.
		 */
		public var alpha:Number;
		
		public function Fill(color:uint = 0xFFFFFF, alpha:Number = 1) {
			this.color = color;
			this.alpha = alpha;
		}
		
		/**
		 * Returns a copy of itself.
		 * @return The copy.
		 */
		public function clone():Fill {
			return new Fill(this.color, this.alpha);
		}
		
	}
}